home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Roll.ieb 1.1, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 25/1 1997 Stockholm/Sweden ** ** Roll image. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Xoff=32 ; Yoff=32 if command ~= '' then parse var command Xoff Yoff 'IE_TO_FRONT' 'FORM "Roll" " OK | Cancel "', ' INTEGER,"X displacement",-4096,4096,'Xoff',SLIDER', ' INTEGER,"Y displacement",-4096,4096,'Yoff',SLIDER' parse var result ok Xoff Yoff if ok = 0 then return '<ERROR>' back = Xoff Yoff return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' parse var options Xoff Yoff 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result 'PROJECT_INFO' LoadImage 'WIDTH' RW=RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' RH=RESULT do until ((Xoff < RW)&(Xoff >= 0)) if Xoff >= (RW-1) then Xoff = Xoff - RW if Xoff < 0 then Xoff = Xoff + RW end do until ((Yoff < RH)&(Yoff >= 0)) if Yoff >= (RH-1) then Yoff = Yoff - RH if Yoff < 0 then Yoff = Yoff + RH end 'MARK' LoadImage 'PRIMARY' 'MARK' LoadImage 'SECONDARY' 'COMPOSITE' Xoff Yoff 'MIX 100' MasterRoll = RESULT 'MARK' LoadImage 'PRIMARY' 'MARK' MasterRoll 'SECONDARY' 'COMPOSITE' Xoff (Yoff-RH) 'MIX 100' ToppedRoll = RESULT 'CLOSE' MasterRoll 'MARK' LoadImage 'PRIMARY' 'MARK' ToppedRoll 'SECONDARY' 'COMPOSITE' (Xoff-RW) Yoff 'MIX 100' SidedRoll = RESULT 'CLOSE' ToppedRoll 'MARK' LoadImage 'PRIMARY' 'MARK' SidedRoll 'SECONDARY' 'COMPOSITE' (Xoff-RW) (Yoff-RH) 'MIX 100' OutputImage = RESULT 'CLOSE' SidedRoll 'CLOSE' LoadImage if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'